<?php
/*
	打印机参数设置
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'setting';
if($_RQ['op']=='setting'){
	if($_RQ['postdata']){
		$post=get_postdata();
		$data=array_fields(array('token','api_key'),$post);
		$this->plugin_setting('setting',$data);
		exi('设置成功！');
	}
	$item=$this->plugin_setting('setting');
	if(!$item){
		$item=array('token'=>'');
	}
	$return['item']=$item;
	$return['htmls']=array(
		'type'=>'edit',
		'desc'=>'设置进云打印机接口参数',
		'edit'=>array(
			array('type'=>'string','name'=>'token','title'=>'用户token','help'=>'前往进云物联官网注册获取'),
			array('type'=>'string','name'=>'api_key','title'=>'用户密钥','help'=>'前往<a href="http://www.jinyunzn.com" target="_blank">【进云物联官网】</a>注册获取。前往<a href="https://shop425715128.taobao.com/" target="_blank">【进云物联淘宝店】</a>购买打印机！'),
		),
	);
	exi($return);
}